package org.techmore.hakka;

import org.techmore.bussiness.QuestionsBeanDataHandler;
import org.techmore.common.utils.activity.ActivityUtils;
import org.techmore.common.utils.sound.SoundPoolUtils;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class QuestionResultActivity extends Activity {
	
	private TextView question_result_resultNum = null;
	private TextView question_result_resultShow = null;
	private TextView question_result_title = null;
	private QuestionsBeanDataHandler questionsBeanDataHandler = null;
	
	private Button answer_again = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		ActivityUtils.getInstance().setScreenOrientation(this);
		setContentView(R.layout.questions_result);
		
		question_result_resultNum = (TextView) findViewById(R.id.question_result_resultNum);
		question_result_resultShow = (TextView) findViewById(R.id.question_result_resultShow);
		question_result_title = (TextView) findViewById(R.id.question_result_title);
		
		questionsBeanDataHandler = QuestionsBeanDataHandler.getInstance();
		
		question_result_title.setText(questionsBeanDataHandler.getQuestionsSize()+getResources().getString(R.string.question_result_title));
		question_result_resultNum.setText(questionsBeanDataHandler.getTotalScore()/questionsBeanDataHandler.getQuestionScore()+"題！");
		question_result_resultShow.setText(questionsBeanDataHandler.getTotalScore()/questionsBeanDataHandler.getQuestionScore()+"顆！");
		
		answer_again = (Button) findViewById(R.id.answer_again);
		
		answer_again.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				SoundPoolUtils.getInstance(QuestionResultActivity.this).playSound(SoundPoolUtils.SOUND_BUTTON_CLICK);
				ActivityUtils.getInstance().leftIN_rightOUT_close_Transition(QuestionResultActivity.this, QuestionResultActivity.this, ChallengeMainActivity.class);
			}
		});
		
		
	}

}
